package com.cw.demo.service.impl;

import com.cw.demo.dao.DeptDao;
import com.cw.demo.dao.impl.DeptDaoImpl;
import com.cw.demo.dao.impl.DeptDaoOracleImpl;
import com.cw.demo.model.Dept;
import com.cw.demo.service.DeptService;

import java.util.List;

public class DeptServiceImpl implements DeptService {

    private int userCount = 1000;

    private DeptDao deptDao;

    public void setDeptDao(DeptDao deptDao) {
        this.deptDao = deptDao;
    }

    public boolean saveDept(Dept dept) {
        return deptDao.saveDept(dept);
    }

    public boolean updateDept(Dept dept) {
        return deptDao.updateDept(dept);
    }

    public boolean deleteDept(int id) {
        return deptDao.deleteDept(id);
    }

    public List<Dept> findByParam(Dept param) {
        userCount+= 1000;
        System.out.println("===================golobalNum="+userCount);
        return deptDao.findByParam(param);
    }


    public void  init(){
        System.out.println("================= 我是spring自定义的一个初始化方法==================");
    }

    public void destroy(){
        System.out.println("================== 我是spring自定义的  对象销毁时，调用 的方法=============");
    }
}
